package battle;

import creature.Attack;
import creature.Creature;
//TODO   Russell is in the process of making this do something
public class Battle
{
	private Creature leftCreature;
	private Creature rightCreature;
	private Creature active;
	private Creature waiting;
	boolean leftIsActive = true;	//true when the leftCreature is active		

	public Battle(Creature c1, Creature c2)
	{
		this.leftCreature = c1;
		this.rightCreature = c2;
		buildBattle();
	}//end constructor

	public void attack(Attack atk)
	{
		waiting.receiveAttack(atk);

		Creature holder = active;
		active = waiting;
		waiting = holder;
		leftIsActive = !leftIsActive;
	}//end attack method

	private void buildBattle()
	{
		//Initialize creatures//
		active = leftCreature;
		waiting = rightCreature;
		leftIsActive = true;
	}//end buildBattle method

	public boolean isOver()
	{		
		if (leftCreature.getHP() <= 0 || rightCreature.getHP() <= 0)
			return true;
		return false;
	}//end isOver method 

	public String toString()
	{
		System.out.println("\n\nThe status of the battle is as follows:");
		System.out.println(leftCreature.getName() + ":\t" + leftCreature.getHP());
		System.out.println(rightCreature.getName() + ":\t" + rightCreature.getHP());
		System.out.print(active.getName() + " is active");

		return "";
	}//end toString
}//end class Battle
